using System.Data.Entity.ModelConfiguration;
using Nop.Core.Domain.Orders;

namespace Nop.Data.Mapping.Orders
{
    public partial class ThirdPartyShippingOptionMap : EntityTypeConfiguration<ThirdPartyShippingOption>
    {
        public ThirdPartyShippingOptionMap()
        {
            this.ToTable("ThirdPartyShippingOption");
            this.HasKey(tpso => tpso.Id);
            this.Property(tpso => tpso.Rate).HasPrecision(18, 4);

            this.Property(tpso => tpso.CreatedOnUTC).IsRequired();
            this.Property(tpso => tpso.Name).IsRequired();
            this.Property(tpso => tpso.CustomerEmail).IsRequired();
            this.Property(tpso => tpso.ShippingAddress).IsRequired();
            this.Property(tpso => tpso.BillingAddress).IsRequired();
            this.Property(tpso => tpso.ShippingRateComputationMethodSystemName).IsRequired();

            this.HasRequired(tpso => tpso.Order)
                .WithMany(o => o.ThirdPartyShippingOptions)
                .HasForeignKey(tpso => tpso.OrderId);
        }
    }
}